#include "qvaluespinbox.h"
#include "dm/dmdef.h"
#include "dm/filter.h"

#include <QDebug>

QValueSpinBox::QValueSpinBox(QWidget *parent)
    : ASpinBox{parent}
{
    setRange(0, static_cast<int>(EQ_Q.size() - 1));
}

QString QValueSpinBox::textFromValue(int value) const
{
    return QString::number(EQ_Q.at(value), 'f', EQ_Q_DECIMAL);
}

int QValueSpinBox::valueFromText(const QString &text) const
{
    return Filter::qToBw(text.toDouble());
}
